<html>
<head><meta charset="utf-8"><title>proc_macro support · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html">proc_macro support</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="221638339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221638339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ciantic <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221638339">(Jan 05 2021 at 11:58)</a>:</h4>
<p>Should the proc_macro support work? I just get "unresolved" import. My test is here: <a href="https://github.com/Ciantic/rust-analyzer-com-rs-failure/blob/master/src/main.rs">https://github.com/Ciantic/rust-analyzer-com-rs-failure/blob/master/src/main.rs</a></p>
<p>It compiles just fine with <code>cargo build</code> but it seems as if the proc_macros doesn't work at all in VSCode.</p>



<a name="221645568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645568">(Jan 05 2021 at 13:29)</a>:</h4>
<p><span class="user-mention" data-user-id="256407">@Ciantic</span> rust-analyzer doesn't support loading crates from sysroot</p>



<a name="221645631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645631">(Jan 05 2021 at 13:30)</a>:</h4>
<p>See also <a href="https://github.com/rust-analyzer/rust-analyzer/issues/6842">https://github.com/rust-analyzer/rust-analyzer/issues/6842</a></p>



<a name="221645649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645649">(Jan 05 2021 at 13:30)</a>:</h4>
<p>sysroot?</p>



<a name="221645664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645664">(Jan 05 2021 at 13:30)</a>:</h4>
<p>Proc_macro is in sysroot too</p>



<a name="221645669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645669">(Jan 05 2021 at 13:30)</a>:</h4>
<p>why is that involved?</p>



<a name="221645673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645673">(Jan 05 2021 at 13:31)</a>:</h4>
<p>Unless you special cased the standard library?</p>



<a name="221645696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645696">(Jan 05 2021 at 13:31)</a>:</h4>
<p>we did</p>



<a name="221645700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645700">(Jan 05 2021 at 13:31)</a>:</h4>
<p>Oh ignore me then</p>



<a name="221645869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645869">(Jan 05 2021 at 13:33)</a>:</h4>
<p>rust-analyzer doesn't handle proc_macros</p>



<a name="221645942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645942">(Jan 05 2021 at 13:34)</a>:</h4>
<p>You need to enable "Load out dirs from check" for them to work</p>



<a name="221645981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221645981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221645981">(Jan 05 2021 at 13:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/122651-general/topic/proc_macro.20support/near/221645942">said</a>:</p>
<blockquote>
<p>You need to enable "Load out dirs from check" for them to work</p>
</blockquote>
<p>Ah yea this does work for running cargo check but you won't get autocomplete</p>



<a name="221646360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221646360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221646360">(Jan 05 2021 at 13:39)</a>:</h4>
<p>"Load out dirs from check" and "Enable proc macro support" will make autocomplete work in supported cases. <code>cargo check</code> always supports proc macros.</p>



<a name="221646565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221646565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221646565">(Jan 05 2021 at 13:41)</a>:</h4>
<p>It looks like in this case the <code>interfaces!</code> macro does get expanded, but the output isn't processed correctly</p>



<a name="221646723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221646723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221646723">(Jan 05 2021 at 13:43)</a>:</h4>
<p>(FYI: I'm the author of the crate in question)</p>



<a name="221651479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221651479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221651479">(Jan 05 2021 at 14:29)</a>:</h4>
<p>Ah, the problem is that the <code>interfaces!</code> macro collides with the <code>interfaces</code> module, apparently, so I'm assuming the macro expansion fails early on, but works from the IDE later</p>



<a name="221653373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221653373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221653373">(Jan 05 2021 at 14:45)</a>:</h4>
<p>Opened <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7171">https://github.com/rust-analyzer/rust-analyzer/pull/7171</a> to help debug this. It does not emit an error in this case, which is strange.</p>



<a name="221653635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221653635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221653635">(Jan 05 2021 at 14:47)</a>:</h4>
<p>I'm looking at the definition of <code>IUnknown</code> for this by the way, in com-rs <code>src/interfaces/iunknown.rs</code></p>



<a name="221653824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221653824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221653824">(Jan 05 2021 at 14:48)</a>:</h4>
<p>(great work on that crate by the way, it looks very clean!)</p>



<a name="221679284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/proc_macro%20support/near/221679284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ciantic <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/proc_macro.20support.html#221679284">(Jan 05 2021 at 17:57)</a>:</h4>
<p>I have these: <a href="https://github.com/Ciantic/rust-analyzer-com-rs-failure/blob/master/.vscode/settings.json">https://github.com/Ciantic/rust-analyzer-com-rs-failure/blob/master/.vscode/settings.json</a> but I guess the error in unresolved import case is different, because those didn't fix it.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>